<template>
	<view>
		<label> navigator</label>
		<!--  在 tabBar 中配置过的页面 不能跳转	 -->
		<navigator url="/pages/pb/pb" hover-class="navigator-hover">
			<button> 跳转到普通页面 </button>
		</navigator>

		<navigator url="/pages/event/index" open-type="switchTab">
			<button type="default">跳转到tabBar页面</button>
		</navigator>

		<label> <strong>利用编程式导航进行跳转</strong></label>
		<button type="primary" @click="gopage">跳转到普通页面</button>
		<button type="primary" @click="gotabBar">跳转到tabBar页面</button>
		<label> redirectTo进行跳转 </label>
		<button type="primary" @click="goMessage">跳转到普通页面</button>

		<label> 导航跳转传递参数</label>
		<button type="primary" @click="goAbout">跳转到普通页面</button>

	 

		<view>
			<login :msg="msg" @myEvent="getMsg"></login>
		</view>

	</view>
</template>

<script>
	import login from "@/components/login.vue"

	export default {
		components: {
			login
		},
		data() {
			return {
				msg: 'hello'
			}
		},
		methods: {
			getMsg(res) {
				console.log(res)
			},
			goAbout() {
				uni.navigateTo({
					url: '/pages/pb/pb?id=80',
				});
			},
			onUnload() {
				console.log('组件卸载了')
			},
			goMessage() {
				uni.redirectTo({
					url: "/pages/pb/pb"
				})
			},
			gotabBar() {
				uni.switchTab({
					url: '/pages/event/index'
				})
			},
			gopage() {
				uni.navigateTo({
					url: '/pages/pb/pb',
				})
			}
		}
	}
</script>

<style>
</style>
